package thread;

import java.util.concurrent.Callable;


/**
 * @author liuchaoqun
 * @date 2022/7/1
 * @Description 可返回结果的task
 */
public class ReturnTask implements Callable<Long> {
    @Override
    public Long call() throws Exception {
        Long startTime = System.currentTimeMillis();
        System.out.println(Thread.currentThread().getName() + "-----线程开始");
        Thread.sleep(1000);
        for (int i = 0; i < 5; i++) {
            int j = i * 10000;
        }
        long used = System.currentTimeMillis() - startTime;
        System.out.println(Thread.currentThread().getName() + "------线程结束");
        return used;
    }
}
